<?php


function file_treat($data)
{
	$tab = explode(";",$data);
	echo "<pre>";
	print_r($tab);
	echo "</pre>";
	return($tab);
}

function open_file($filename, $id_magasin = 0, $max = 10)
{
 if (!is_file($filename))
    throw new Exception("Le fichier n'existe pas !");
 if (($handle = fopen($filename, "r")) < 0)
    throw new Exception("Impossible d'ouvrir le fichier !");
 fgets($handle);
 $recup = array();
 while ($data = fgets($handle))
 {
       $recup[] = file_treat($data);
       echo "----------------------------------<br />";
       if (count($recup) > 10)
       break;
 }
 fclose($handle);
 foreach ($recup as $key=>$val)
 {
  echo "insert_produit($val[11], $val[10], )<br />";
 }
}

open_file("export.csv");

?>